package org.dromara.iot.scheduled;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.iot.service.IIotUpkeepInfoService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Slf4j
@RequiredArgsConstructor
@Service
public class IotElevatorScheduled {
    private final IIotUpkeepInfoService upkeepInfoService;

    /**
     * 查询如果需要保养的电梯进行保养(定时器每天凌晨1点执行一次)
     *
     * @return void
     */
    @Scheduled(cron = "0 0 1 * * ?")
    public void saveUpkeepBusinessInfo() {
        log.info("开始执行电梯保养计划定时任务");
        upkeepInfoService.saveUpkeepBusinessInfo();
        log.info("结束执行电梯保养计划定时任务");
    }
}
